package com.lagou.ipersistence.scripting;

import com.lagou.ipersistence.executor.parameter.ParameterHandler;
import com.lagou.ipersistence.mapping.BoundSql;
import com.lagou.ipersistence.mapping.MappedStatement;
import com.lagou.ipersistence.mapping.SqlSource;
import com.lagou.ipersistence.parsing.XNode;
import com.lagou.ipersistence.session.Configuration;

/**
 * 语言动态驱动接口
 *
 * @author Yan Jiahong
 * Created on 2020/11/16
 */
public interface LanguageDriver {
    SqlSource createSqlSource(Configuration configuration,  String script, Class<?> parameterType);

    /**
     * 根据一个代表Mapper XML中一个增删查改语句节点的XNode创建SqlSource
     *
     * @param configuration 全局配置容器
     * @param script 从Mapper.xml中解析到的一个statement节点(select|delete|update|insert)
     * @param parameterType 参数类型
     *
     * @see SqlSource
     */
    SqlSource createSqlSource(Configuration configuration, XNode script, Class<?> parameterType);
    
    ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql);
}
